<?php
/************************
* Simple News Engine 0.2.3
* author: Ragnaar <ragnaar@km.ru>
* home: http://code.google.com/p/sne-news
* date: 08.06.2011
*********************/
defined( '_VALID_SNE' ) or die( 'Direct Access to this location is not allowed.' );

// jQuery
$jqueryJs = "
    <script type=\"text/javascript\" src=\"./js/jquery.min.js\"></script>
";

// JavaScript загрузки картинок
$uploadJs = "
	<script type=\"text/javascript\" src=\"./js/handlers.js\"></script>
	<script language=\"javascript\" type=\"text/javascript\">
	<!--
	function startUpload(){
    	document.getElementById('f1_upload_process').style.visibility = 'visible';
    	document.getElementById('f1_upload_form').style.visibility = 'hidden';
    	return true;
	}
	function stopUpload(success,fileid){
    	var result = '';
    	if (success == 1){
    		result = '<span class=\"msg\">"._SNE_UPLOAD_SUCCESSFULLY."<\/span>';
			addImage(\"./thumb/\"+ fileid);
			addInput(fileid);
			document.getElementById('thumbnails').style.visibility = 'visible';
		} else {
			result = '<span class=\"emsg\">"._SNE_UPLOAD_ERROR."' + success + '<\/span><br/><br/>';
		}
			document.getElementById('f1_upload_process').style.visibility = 'hidden';
			document.getElementById('f1_upload_form').innerHTML = '<label>File: <input name=\"myfile\" type=\"file\" size=\"30\"  onchange=\"startUpload();document.pictureform.submit();\" /><\/label>' +result;
			document.getElementById('f1_upload_form').style.visibility = 'visible';
		return true;
	}
	//-->
	</script>
";

// JavaScript для подтверждения удаления новостей
$deleteJs = "
	<script type='text/javascript'>
		function Delete(N,P) {
			if(confirm(\"Удалить запись?\")) {
				parent.location='?action=delete&id='+N+'&p='+P;
			} else {
				return false;
			}
		}
	</script>
";

// JavaScript для подключения ImgBox
$imgboxJs = "
	<script type=\"text/javascript\" src=\"./js/jquery.imgbox.min.js\"></script>
	<link type=\"text/css\"rel=\"stylesheet\" href=\"./js/jquery.imgbox.css\" />
	<script type=\"text/javascript\">
		$(document).ready(function() {
			$(\".imgbox\").imgbox();
		});
	</script>
";

// JavaScript для подключения CLEditor
$cleditorJs = "
    <link rel=\"stylesheet\" type=\"text/css\" href=\"./js/jquery.cleditor.css\" />
    <script type=\"text/javascript\" src=\"./js/jquery.cleditor.min.js\"></script>
    <script type=\"text/javascript\" src=\"./js/jquery.cleditor.cut.min.js\"></script>
    <script type=\"text/javascript\">
      $(document).ready(function() {
        $('#text').cleditor({
		    width:        750,
		    height:        400,
			controls:     'undo redo | bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | rule image link unlink | pastetext source | cutx',
			docCSSFile: './css/cleditor.css'
		});
      });
    </script>
";

// Socialization
if ($socialization == 1){
    if ($socialnet == "vk"){
        $socialnetInitJs = "
		<script type=\"text/javascript\" src=\"http://platform.twitter.com/widgets.js\"></script>
		<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\">{lang: '".$goo_lang."'}</script>
        <script type=\"text/javascript\" src=\"http://userapi.com/js/api/openapi.js?26\"></script>
        <script type=\"text/javascript\">
                VK.init({apiId: ".$vk_apiid.", onlyWidgets: true});

                function addComment(num, last_comment, date, sign) {
                    var result=".$id.";
                    $.ajax({
                        type: \"POST\",
                        url: \"./inc/comments.php\",
                        data: \"num= \" +num+ \"&date=\" +date+ \"&socnet=vk&id=\" +result,
                        success: function(html){
                            $(\".ncomm\").hide();
                            $(\".ndate\").after(html);
                        }
                    });
                };
        </script>
        ";
        $socialnetLikeJs = "
    <div id=\"vk_like\"></div>
    <script type=\"text/javascript\">
        VK.Widgets.Like(\"vk_like\", {type: \"".$vk_like_type."\", pageDescription: \"".$title."\", width: \"".$vk_like_width."\"});
    </script>
    <g:plusone size=\"".$goo_size."\"></g:plusone>
	<a href=\"http://twitter.com/share\" class=\"twitter-share-button\" data-count=\"".$tw_type."\" data-lang=\"".$tw_lang."\">Tweet</a>
        ";
        $socialnetJs = "
    <h3 id=\"comments\">"._SNE_COMMENTS_TITLE."</h3>
        <div id=\"vk_comments\"></div>
        <script type=\"text/javascript\">
                VK.Widgets.Comments(\"vk_comments\", {limit: ".$vk_width.", width: \"".$vk_width."\", attach: ".$vk_attach.", autoPublish: ".$vk_pub.", onChange: addComment});
        </script>
        ";
    }
    if ($socialnet == "fb"){
        $socialnetInitJs = "
    <meta property=\"fb:app_id\" content=\"".$fb_appid."\">
    <script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\">{lang: '".$goo_lang."'}</script>
	<script type=\"text/javascript\" src=\"http://platform.twitter.com/widgets.js\"></script>
        ";
        $socialnetLikeJs = "
    <div id=\"fb-root\"></div>
    <script src=\"http://connect.facebook.net/".$fb_lang."/all.js#appId=".$fb_appid."&amp;xfbml=1\"></script>
    <fb:like href=\"\" send=\"false\" layout=\"".$fb_like_type."\" width=\"".$fb_like_width."\" show_faces=\"".$fb_like_show_faces."\" font=\"".$fb_like_font."\"></fb:like>
    <g:plusone size=\"".$goo_size."\"></g:plusone>
	<a href=\"http://twitter.com/share\" class=\"twitter-share-button\" data-count=\"".$tw_type."\" data-lang=\"".$tw_lang."\">Tweet</a>
        ";
        $socialnetJs = "
    <h3 id=\"comments\">"._SNE_COMMENTS_TITLE."</h3>
    <div id=\"fb-root\"></div>
    <fb:comments href=\"".$newsPath."?mode=news&id=".$id."\" num_posts=\"".$fb_num."\" width=\"".$fb_width."\"></fb:comments>
        ";
    }
}

?>